package com.netease.nim.uikit.business.ait.selector.holder

import android.view.View
import androidx.databinding.DataBindingUtil
import com.netease.nim.uikit.R
import com.netease.nim.uikit.api.NIMHelper
import com.netease.nim.uikit.api.SessionHelper
import com.netease.nim.uikit.business.ait.selector.model.AitContactItem
import com.netease.nim.uikit.business.team.helper.TeamHelper
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseQuickAdapter
import com.netease.nim.uikit.common.ui.recyclerview.holder.BaseViewHolder
import com.netease.nim.uikit.common.ui.recyclerview.holder.RecyclerViewHolder
import com.netease.nim.uikit.databinding.ItemFriendsBinding
import com.netease.nimlib.sdk.team.model.TeamMember
import www.wen.com.common.lib.data.entities.ServiceMemberEntity
import www.wen.com.common.lib.extension.getDrawableAgency
import www.wen.com.common.lib.extension.glide.setImageUrl

class TeamMemberViewHolder2(baseQuickAdapter: BaseQuickAdapter<AitContactItem<TeamMember>, BaseViewHolder>) :
    RecyclerViewHolder<BaseQuickAdapter<AitContactItem<TeamMember>, BaseViewHolder>, BaseViewHolder, AitContactItem<TeamMember>>(
        baseQuickAdapter
    ) {
    private var binding: ItemFriendsBinding? = null

    override fun convert(
        holder: BaseViewHolder,
        data: AitContactItem<TeamMember>,
        position: Int,
        isScrolling: Boolean
    ) {
        data.let {
            binding = DataBindingUtil.bind(holder.itemView)
            binding?.apply {
                tvSubtitle.visibility = View.GONE
                imgArrow.visibility = View.GONE
                tvTopStatus.visibility = View.GONE
                slUnreadMessage.visibility = View.GONE
                imgOnlineStatus.visibility = View.GONE

                ivAvatar.resetImageView()
                ivAvatar.loadBuddyAvatar(it.model.account)
                tvTitle.text = TeamHelper.getTeamMemberDisplayName(it.model.tid, it.model.account)
            }
        }
    }
}